home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
comm
/
cnet
/
colorutils.lha
/
ColorUtils
< prev
next >
Wrap
Text File
|
1995-10-07
|
43KB
|
641 lines
/**************************************************************************\
$VER: Color Utilities, v1.2 (7-Oct-95) by Dotoran!
\**************************************************************************/
options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
tr=transmit ; se=sendstring ; gc=getchar ; gu=getuser ; gs=getscratch
qu=query ; changewhere 'Color Utils'
BEGIN: /* Define Variables and Display Title Screen */
call SETUP ; call TITLE
call INFO('c6Select cfConversion c6using cbARROW KEYSc6, press caENTERc6/caRETURN c6to select...') ; call HELP11
START: /* Start of Main Operations Menu (Choose Conversion) */
se 'u' ; r=pt1r ; c=pt1c ; gc ; a=result ; call CHECK
if c2d(a)=13 then signal START2
if c2d(a)=27 then do ; gc ; gc ; b=result
if b='A' then do ; pt1r=pt1r-1 ; if pt1r=0 then pt1r=2 ; end
if b='B' then do ; pt1r=pt1r+1 ; if pt1r=3 then pt1r=1 ; end
if b='C' then do ; pt1c=pt1c+1 ; if pt1c=7 then pt1c=1 ; end
if b='D' then do ; pt1c=pt1c-1 ; if pt1c=0 then pt1c=6 ; end ; end
if a='L' then do ; pt1r=1 ; pt1c=1 ; end ; if a='Y' then do ; pt1r=1 ; pt1c=2 ; end
if a='S' then do ; pt1r=1 ; pt1c=3 ; end ; if a='M' then do ; pt1r=1 ; pt1c=4 ; end
if a='I' then do ; pt1r=1 ; pt1c=5 ; end ; if a='X' then do ; pt1r=1 ; pt1c=6 ; end
if a='H' then do ; pt1r=2 ; pt1c=1 ; end ; if a='N' then do ; pt1r=2 ; pt1c=2 ; end
if a='O' then do ; pt1r=2 ; pt1c=3 ; end ; if a='C' then do ; pt1r=2 ; pt1c=4 ; end
if a='D' then do ; pt1r=2 ; pt1c=5 ; end ; if a='Q' then do ; pt1r=2 ; pt1c=6 ; end
tr 'z0'op.r.c'z4'op.pt1r.pt1c'z0' ; call HELP ; signal START
START2: /* If Expansion Slot or Quit is Chosen, Handle Correctly. */
if r=1 & c=6 then do
call INFO('c6There is cacurrently c9NO c6utility module cbassociated c6with this button...c7<cdkeyc7>g1')
call INFO('c6Select cfConversion c6using cbARROW KEYSc6, press caENTERc6/caRETURN c6to select...')
signal START ; end
if r=2 & c=6 then do ; call INFO('cdQuitc6, c9NO c6questions asked...')
tr '1H' ; exit ; end
START3: /* Get PATH and FILE to Convert. (Error Handling As Well) */
call INFO('c6Type the caPATHc6/caFILENAME c6of the file you wish to cbConvertc6...')
se '21Hz1cf'copies(' ',57)'21Hi0 57}z0' ; gu 70 ; path=strip(result)
if path='' then do
call INFO('c6You c9MUST c6supply a caPATHc6/caFILENAME c6to ceLOAD c6from...c7<cdkeyc7>g1')
addkeys (path) ; signal START ; end
if word(statef(path),1)="DIR" then dir=1 ; else dir=0
if ~exists(path) & dir=1 then do
call INFO('c6The specified caPATH c6does c9NOT c6exist...c7<cdkeyc7>g1')
addkeys (path) ; signal START3 ; end
if dir=1 then do ; zz=showdir(path,'f',' ')
call INFO('cfReplace caoriginal c6files with cbconverted c6files? c7[caYesc7]c9:')
se '55H';gc;aa=result;if aa="N" then do;tr "cbNoc6.";replace=0;end
else do;tr "caYesc6!";replace=1;end;signal START4A;end
if ~exists(path) then do
call INFO('c6Was c9NOT c6able to cffind c6specified file...c7<cdkeyc7>g1')
addkeys (path) ; signal START3 ; end ; else do;file1=path;zz=file1;end
START4: /* Get PATH & FILE to SAVE Converted File AS. (Error Checking Too) */
call INFO('c6Type the caPATHc6/caFILENAME c6you wish the cbConverted c6file to be ceSAVED c6as...')
addkeys (file1) ; se '21Hz1cf'copies(' ',57)'21Hi0 57}z0' ; gu 70 ; a=strip(result)
if a='' then do
call INFO('c6You c9MUST c6supply a caPATHc6/caFILENAME c6to ceSAVE c6to...c7<cdkeyc7>g1')
addkeys (a) ; signal START3 ; end
if right(a,1)=':' | right(a,1)='/' then do
call INFO('c6You c9MUST c6also specify a caFILENAME c6to ceSAVE c6to...c7<cdkeyc7>g1')
addkeys (a) ; signal START4 ; end
if exists(a) & a~=file1 then do
call INFO('c6Another file is cbUsing c6this name. c9Overwritec6? c7[caYesc7]c6: ca')
gc ; b=result ; if b='N' then do ; tr 'No.' ; signal START4 ; end
tr 'Yes!' ; end ; file2=a
START4A:
call INFO('c6Select cbView Modec6, caENTERc6/caRETURN c6to select...') ; call HELPB1
START5: /* Start of VIEW MODE Menu */
se 'u' ; cc=pt2c ; gc ; a=result ; call CHECK
if c2d(a)=13 then do ; view=cc ; call HELPC1 ; signal START6 ; end
if c2d(a)=27 then do ; gc ; gc ; b=result
if b='C' then do ; pt2c=pt2c+1 ; if pt2c=5 then pt2c=1 ; end
if b='D' then do ; pt2c=pt2c-1 ; if pt2c=0 then pt2c=4 ; end ; end
if a='N' then do ; pt2c=1 ; end ; if a='B' then do ; pt2c=2 ; end
if a='A' then do ; pt2c=3 ; end ; if a='O' then do ; pt2c=4 ; end
tr 'z0'vi.cc'z4'vi.pt2c'z0' ; call HELPB ; signal START5
START6: /* After View Mode Is Selected */
call INFO('c6Select c9Start Modec6, caENTERc6/caRETURN c6to select...')
START6B: /* Start of START MODE Menu */
se 'u' ; cc=pt3c ; gc ; a=result ; call CHECK
if c2d(a)=13 then do ; mode=cc ; signal START7 ; end
if c2d(a)=27 then do ; gc ; gc ; b=result
if b='C' then do ; pt3c=pt3c+1 ; if pt3c=6 then pt3c=1 ; end
if b='D' then do ; pt3c=pt3c-1 ; if pt3c=0 then pt3c=5 ; end ; end
if a='S' then do ; pt3c=1 ; end ; if a='Q' then do ; pt3c=2 ; end
if a='R' then do ; pt3c=3 ; end ; if a='C' then do ; pt3c=4 ; end
if a='I' then do ; pt3c=5 ; end
tr 'z0'mo.cc'z4'mo.pt3c'z0' ; call HELPC ; signal START6B
START7: /* Handle Various Start Modes. Branch Where Neccessary. */
if mode=1 then signal START8
if mode=2 then do
call INFO('c6You really wish to c9QUIT c6now? c7[caYesc7]c6: ca')
gc ; a=result ; if a='N' then do ; tr 'No.' ; signal START6 ; end
tr 'Yes!1H' ; exit ; end
if mode=3 then do
call INFO('c6You wish to cbRESTART ceColor Utilsc6? c7[caYesc7]c6: ca')
gc ; a=result ; if a='N' then do ; tr 'No.' ; signal START6 ; end
tr 'Yes!' ; signal BEGIN ; end
if mode=4 then do ; call CHART ; call TITLE ; tr op.1.1'z4'op.r.c'z0'
tr '21Hz1cf'file1'z021Hz1cf'file2'z0'
tr vi.1'z4'vi.view'z0'mo.1'z4'mo.mode'z0'
call HELPC ; signal START6 ; end
if mode=5 then do
call INFO('cdDotoran cfThanks You c6for using caanother c6of his cbcreationsc6! c7<cdkeyc7>g1')
signal START6 ; end
START8: /* Display BEFORE or BOTH file if need be, then start Conversion. */
do loop=1 to words(zz)
if words(zz)>1 then do
if index("/:",right(path,1))=0 then path=path"/"
file1=path||word(zz,loop) ; file2=file1
if replace=0 then file2=file2".2";end
if view=2 | view=4 then do
tr 'f1c6<< c9START c6>> caPathc6/caFilec6--> cb'file1'n1*0'file1'}'
tr 'c6<< c9END c6>> caPathc6/caFilec6--> cb'file1'n2c6->cdKeyg1'
call TITLE ; tr op.1.1'z4'op.r.c'z0' ; end
tr '21Hz1cf'left(file1,40)'z0';tr'21Hz1cf'left(file2,40)'z0'
tr vi.1'z4'vi.view'z0'mo.1'z4'mo.mode'z0'
if r=1 & c=4 then call MODULE4 ; if r=2 & c=4 then call MODULE9
call CLEAR ; steps=0 ; sleft=0 ; lines=0 ; codes=0
call INFO('caPlease hold... cbConverting c9"ce'file1'c9" cbnow...')
tr '3Hc6Reading Linec9: ca----- c6Total Stepsc9: ca- c6Working Stepc9: ca-'
tr '3Hc6Working Linec9: ca----- c6Converted Linesc9: ca----- c6Converted Codesc9: ca-----'
tr '3Hc6Writing Linec9: ca-----'
if r=1 & c=1 then call MODULE1 /* Low 8 to High 8 */
if r=1 & c=2 then call MODULE2 /* Control-Y to Control-Q */
if r=1 & c=3 then call MODULE3 /* Slash to Control-Y */
if r=1 & c=4 then call MODULE4E /* MCI Color Swapper */
if r=1 & c=5 then call MODULE5 /* High to Low / Low to High */
if r=2 & c=1 then call MODULE6 /* High 8 to Low 8 */
if r=2 & c=2 then call MODULE7 /* Control-Q to Control-Y */
if r=2 & c=3 then call MODULE8 /* Old to New Color Order */
if r=2 & c=4 then call MODULE9E /* MCI Color Changer */
if r=2 & c=5 then call MODULE10 /* MCI Color Stripper */
START9: /* Display file if AFTER or BOTH View Mode was Chosen. */
if view=3 | view=4 then do
tr 'f1c6<< c9START c6>> caPathc6/caFilec6--> cb'file2'n1*0'file2'}'
tr 'c6<< c9END c6>> caPathc6/caFilec6--> cb'file2'n2c6->cdKeyg1'
call TITLE ; tr op.1.1'z4'op.r.c'z0'
tr '21Hz1cf'file1'z021Hz1cf'file2'z0'
tr vi.1'z4'vi.view'z0'mo.1'z4'mo.mode'z0' ; end
end loop
START9B: /* Either AFTER File is Displayed, or AFTER Conversion Finishes. */
call INFO('c6Perform ceanother cbConversion c6now? c7[caYesc7]c6: ca')
gc ; a=result ; if a='N' then do ; tr 'No.1H' ; exit ; end
tr 'Yes!'
signal BEGIN
MODULE1: /* Change Low 8 MCI Colors into High 8 MCI Colors */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 8 ; a=word(c1,j) ; b=word(c2,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE2: /* Change Control-Y MCI Colors into Control-Q MCI Colors */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c4,j) ; b=word(c6,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do
l.i=delstr(l.i,z,3) ; l.i=insert(b,l.i,z-1,4)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE3: /* Change Slash MCI Colors into Control-Y MCI Colors */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'\c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c3,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE4: /* Change Set MCI Colors to Other MCI Colors (Swap Them) */
if loop>1 then return;else call GRID1
MODULE4A: /* Get the FIRST Color */
call INFO('c6Select c9Color c6to cbSWAPc9: c6Now Select c9Color c6to Swap cbWITHc9: ')
se '25Hca' ; gc ; a=index('0123456789ABCDEFGHIJKLMNUQ',result) ; call CHECK
if a=0 then signal MODULE4A ; if a<17 then signal MODULE4B
if a>16 & a<25 then do ; a=a-16 ; signal MODULE4C ; end
if a=25 then signal MODULE4D ; if a=26 then do ; tr 'cdQuit'
call GRID2 ; signal START9B ; end
MODULE4B: /* Get the SECOND Color, IF the FIRST Color is FOREGROUND Color. */
tr substr('0123456789ABCDEF',a,1) ; a1=a
se '64H <1ca' ; gc ; b=index('0123456789ABCDEF',result) ; call CHECK
if b=0 | b=a then signal MODULE4B
else do ; tr substr('0123456789ABCDEF',b,1) ; a2=b ; end
tr 'c'sw.a2||mc.a1'c'sw.a1||mc.a2
t=sw.a1 ; sw.a1=sw.a2 ; sw.a2=t
signal MODULE4A
MODULE4C: /* Get the SECOND Color, IF the FIRST Color is BACKGROUND Color. */
tr substr('01234567',a,1) ; a1=a
se '64H <1ca' ; gc ; b=index('GHIJKLMN',result) ; call CHECK
if b=0 | b=a then signal MODULE4C
else do ; tr substr('01234567',b,1) ; a2=b ; end
a3=a1+16 ; a4=a2+16 ; tr 'c'sw.a4||mz.a1'c'sw.a3||mz.a2
t=sw.a3 ; sw.a3=sw.a4 ; sw.a4=t
signal MODULE4A
MODULE4D: /* Create the CONVERSION String, then Clean Up Screen. */
a='' ; do i=1 to 16 ; a=a'\c'sw.i' ' ; end i
do i=17 to 24 ; a=a'\z'sw.i' ' ; end ; c0=a ; call GRID2
return
MODULE4E: /* Actual Color Swap Conversion Routine Starts Here. */
call READFILE ; steps=2 ; sleft=2 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c4,j) ; b=word(c0,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1 ; lines=0 ; codes=0
tr '71H'sleft ; do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'\c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c3,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE5: /* Make High 8 MCI Colors into Low 8 MCI Colors & Vice Versa */
call READFILE ; steps=3 ; sleft=3 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 8 ; a=word(c1,j) ; b=word(c8,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; codes=0 ; lines=0 ; sleft=sleft-1 ; tr '71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 8 ; a=word(c2,j) ; b=word(c7,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; codes=0 ; lines=0 ; sleft=sleft-1 ; tr '71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'\c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 16 ; a=word(c3,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1 ; tr '71H'sleft ; call SAVEFILE
return
MODULE6: /* Change High 8 MCI Colors to Low 8 MCI Colors (NO BRIGHTS) */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 8 ; a=word(c2,j) ; b=word(c1,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE7: /* Change Control-Q MCI Colors into Control-Y MCI Colors */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c6,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do
l.i=delstr(l.i,z,4) ; l.i=insert(b,l.i,z-1,3)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE8: /* Change from Old MCI Color Order to New MCI Color Order */
call READFILE ; steps=2 ; sleft=2 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c5,j) ; b=word(c3,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1 ; lines=0 ; codes=0
tr '71H'sleft ; do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'\c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c3,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE9: /* Change Set MCI Colors to Other MCI Colors (Change Them) */
if loop>1 then return;else call GRID1
MODULE9A: /* Get COLOR to CHANGE */
call INFO('c6Select c9Color c6to cbCHANGEc9: c6Now Select c9Color c6to Change cbTOc9: ')
se '27Hca' ; gc ; a=index('0123456789ABCDEFGHIJKLMNUQ',result) ; call CHECK
if a=0 then signal MODULE9A ; if a<17 then signal MODULE9B
if a>16 & a<25 then do ; a=a-16 ; signal MODULE9C ; end
if a=25 then signal MODULE9D ; if a=26 then do ; tr 'cdQuit'
call GRID2 ; signal START9B ; end
MODULE9B: /* CHANGE Color to THIS Color if FOREGROUND. */
tr substr('0123456789ABCDEF',a,1) ; a1=a
se '66H <1ca' ; gc ; b=index('0123456789ABCDEF',result) ; call CHECK
if b=0 then signal MODULE4B
else do ; z=substr('0123456789abcdef',b,1) ; tr z ; a2=b ; end
tr 'c'sw.a2||mc.a1 ; sw.a1=z
signal MODULE9A
MODULE9C: /* CHANGE Color to THIS Color if BACKGROUND. */
tr substr('01234567',a,1) ; a1=a
se '66H <1ca' ; gc ; b=index('GHIJKLMN',result) ; call CHECK
if b=0 then signal MODULE9C
else do ; z=substr('01234567',b,1) ; tr z ; a2=b ; end
a3=a1+16 ; a4=a2+16 ; tr 'c'sw.a4||mz.a1 ; sw.a3=z
signal MODULE9A
MODULE9D: /* Create Conversion String & Clean Up Screen. */
a='' ; tr 'c9Use' ; do i=1 to 16 ; a=a'\c'sw.i' ' ; end i
do i=17 to 24 ; a=a'\z'sw.i' ' ; end ; c0=a ; call GRID2
return
MODULE9E: /* Actual MCI Change Conversion Routine Starts Here. */
call READFILE ; steps=2 ; sleft=2 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c4,j) ; b=word(c0,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1 ; lines=0 ; codes=0
tr '71H'sleft ; do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'\c')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
do j=1 to 24 ; a=word(c3,j) ; b=word(c4,j)
do until z=0 ; z=index(l.i,a) ; if z>0 then do ; l.i=overlay(b,l.i,z)
codes=codes+1 ; tr '71H'right(codes,5,'-') ; end
end ; end j ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
MODULE10: /* Strip ALL 3-Character Control-Y MCI Codes from the file. */
call READFILE ; steps=1 ; sleft=1 ; tr '44Hca'steps'71H'sleft
do i=1 to tot ; tr '17H'right(i,5,'-')
if index(l.i,'')=0 then iterate i
else do ; lines=lines+1 ; tr '44H'right(lines,5,'-') ; end
a='' ; do until z=0 ; z=index(l.i,a) ; if z>0 then do
l.i=delstr(l.i,z,3) ; codes=codes+1 ; tr '71H'right(codes,5,'-')
end ; end ; end i ; sleft=sleft-1
tr '71H'sleft ; call SAVEFILE
return
READFILE: /* Read In "line by line" the ORIGINAL File. */
call open(f1,file1,'r') ; i=0
do until eof(f1) ; i=i+1 ; se '17H'right(i-1,5,'-')
l.i=readln(f1) ; end ; tot=i-1
call close(f1) ; tr ' c9Donec6.'
return
SAVEFILE: /* Save "line by line" the CONVERTED File. */
call open(f1,file2,'w')
do i=1 to tot ; call writeln(f1,l.i)
se '17H'right(i,5,'-') ; end i
call close(f1) ; se ' c9Donec6. '
if words(zz)=1 then se 'c7<cdkeyc7>g1'
return
CLEAR: /* Clears text box at BOTTOM of Window. */
do i=18 to 22 ; tr ''i';2H'copies(' ',77) ; end i
return
INFO: /* Displays INFO Text in box right above LARGE Text box. */
parse arg text
tr '3H'copies(' ',76)
se '3H'text's'
return
SETUP: /* Define Conversion Strings, Screen Display Strings, Variables */
file1='' ; file2='' ; pt1r=1 ; pt1c=1 ; pt2c=1 ; pt3c=1
sw='0123456789abcdef01234567' ; do i=1 to 24 ; sw.i=substr(sw,i,1) ; end i
c1='c0 c1 c2 c3 c4 c5 c6 c7' /* Control-Y low 8 colors. */
c2='c8 c9 ca cb cc cd ce cf' /* Control-Y high 8 colors. */
/* c3=slash new order codes, c4=control-y new order codes. */
c3='\c0 \c1 \c2 \c3 \c4 \c5 \c6 \c7 \c8 \c9 \ca \cb \cc \cd \ce \cf \z0 \z1 \z2 \z3 \z4 \z5 \z6 \z7'
c4='c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf z0 z1 z2 z3 z4 z5 z6 z7'
/* c5=control-y old order codes. */
c5='c0 c7 c1 c6 c5 c2 c4 c3 c8 cf c9 ce cd ca cc cb z0 z7 z1 c6 z5 z2 z4 z3'
/* c6=control-q new order codes. */
c6='c0} c1} c2} c3} c4} c5} c6} c7} c8} c9} ca} cb} cc} cd} ce} cf} z0} z1} z2} z3} z4} z5} z6} z7}'
c7='\c0 \c1 \c2 \c3 \c4 \c5 \c6 \c7' /* Slash low 8 colors. */
c8='\c8 \c9 \ca \cb \cc \cd \ce \cf' /* Slash high 8 colors. */
op.1.1='2Hce u1Lu0ow 8 to 2H High 8 ' ; op.2.1='2Hcb u1Hu0igh 8 2H to Low 8 '
op.1.2='5Hcb Control-u1Yu0 5H Control-Q ' ; op.2.2='5Hce Cou1nu0trol-Q 5H Control-Y '
op.1.3='8Hce u1Su0lash to 8H Control-Y ' ; op.2.3='8Hcb u1Ou0ld to New 8H Code Order '
op.1.4='1Hcb u1Mu0CI Color 1H Swapper ' ; op.2.4='1Hce MCI u1Cu0olor 1H Changer '
op.1.5='4Hce Hu1iu0gh 2 Low 4H Low 2 High ' ; op.2.5='4Hcb MCI Cou1du0e 4H Stripper '
op.1.6='7Hcb Eu1xu0pansion 7H Slot # 1 ' ; op.2.6='7Hce u1Qu0uit Back 7H to CNet '
vi.1='03Hce u1Nu0EITHER ' ; vi.2='13Hcb u1Bu0EFORE ' ; vi.3='22Hce u1Au0FTER ' ; vi.4='30Hcb Bu1Ou0TH '
mo.1='39Hce u1Su0TART ' ; mo.2='47Hcb u1Qu0UIT ' ; mo.3='54Hce u1Ru0ESTART '
mo.4='64Hcb u1Cu0HART ' ; mo.5='72Hce u1Iu0NFO '
mc.1 ='02H█' ; mc.2 ='04H█' ; mc.3 ='06H█' ; mc.4 ='08H█'
mc.5 ='10H█' ; mc.6 ='12H█' ; mc.7 ='14H█' ; mc.8 ='16H█'
mc.9 ='18H█' ; mc.10='20H█' ; mc.11='22H█' ; mc.12='24H█'
mc.13='26H█' ; mc.14='28H█' ; mc.15='30H█' ; mc.16='32H█'
mz.1 ='64H█' ; mz.2 ='66H█' ; mz.3 ='68H█' ; mz.4 ='70H█'
mz.5 ='72H█' ; mz.6 ='74H█' ; mz.7 ='76H█' ; mz.8 ='78H█'
return
TITLE: /* Main Title Screen (Created Using An ANSI-Drawing Program) */
tr 'f1@4
┌─────────────────────────────────────────────────────────────────────────────┐'
tr '│
CNet Amiga MCI Color Updater/Converter Utility by Dotoran of Frontiers!
│'
tr '├────────────┬────────────┬────────────┬────────────┬────────────┬────────────┤'
tr '│
u1Lu0ow 8 to
│
Control-u1Yu0
│
u1Su0lash to
│
u1Mu0CI Color
│
Hu1iu0gh 2 Low
│
Eu1xu0pansion
│'
tr '│
High 8
│
Control-Q
│
Control-Y
│
Swapper
│
Low 2 High
│
Slot #1
│'
tr '├────────────┼────────────┼────────────┼────────────┼────────────┼────────────┤'
tr '│
u1Hu0igh 8
│
Cou1nu0trol-Q
│
u1Ou0ld to New
│
MCI u1Cu0olor
│
MCI Cou1du0e
│
u1Qu0uit Back
│'
tr '│
to Low 8
│
Control-Y
│
Code Order
│
Changer
│
Stripper
│
to CNet
│'
tr '├────────────┴────────────┴────────────┴────────────┴────────────┴────────────┤'
tr '│
Path
/
File
to
LOAD
:
│'
tr '├─────────────────────────────────────────────────────────────────────────────┤'
tr '│
Path
/
File
to
SAVE
:
│'
tr '├───────────────────────────────────┬─────────────────────────────────────────┤'
tr '│
u1Nu0EITHER
u1Bu0EFORE
u1Au0FTER
Bu1Ou0TH
│
u1Su0TART
u1Qu0UIT
u1Ru0ESTART
u1Cu0HART
u1Iu0NFO
│'
tr '├───────────────────────────────────┴─────────────────────────────────────────┤'
tr '│C│'
tr '├─────────────────────────────────────────────────────────────────────────────┤'
do 5 ; tr '│C│' ; end
tr '└─────────────────────────────────────────────────────────────────────────────┘'
return
CHART: /* MCI-ANSI Color Code Chart (Also Created Using An ANSI-Drawer) */
tr 'f1
┌─────────────────────────────────────────────────────────────────────────────┐'
tr '│
\ is a Control-Y C
MCI/ANSI Color Chart C
~ is an ESC(ape) Key
│'
tr '├────────────────┬────────────────┬────────────────────┬──────────────────────┤'
tr '│
OLD Order MCI
│
NEW Order MCI
│
ANSI ForeGrounds
│
ANSI BackGrounds
│'
tr '├────────────────┼────────────────┼────────────────────┼──────────────────────┤'
tr '│ \c0
-
Black
│
\c0
-
Black
│
~[0;30m
-
Black
│
~[0;40m
-
Black
│'
tr '│ \c1
-
White
│
\c1
-
RedC
│
~[0;31m
-
RedC
│
~[0;41m
-
Red
│'
tr '│
\c2 - RedC
│
\c2
-
Green
│
~[0;32m
-
Green
│
~[0;42m
-
Green
│'
tr '│
\c3 - CyanC
│
\c3
-
Yellow
│
~[0;33m
-
Yellow
│
~[0;43m
-
Yellow
│'
tr '│
\c4 - Purple
│
\c4
-
BlueC
│
~[0;34m
-
BlueC
│
~[0;44m
-
Blue
│'
tr '│
\c5 - Green
│
\c5
-
Purple
│
~[0;35m
-
Purple
│
~[0;45m
-
Purple
│'
tr '│
\c6 - BlueC
│
\c6
-
CyanC
│
~[0;36m
-
CyanC
│
~[0;46m
-
Cyan
│'
tr '│
\c7 - Yellow
│
\c7
-
White
│
~[0;37m
-
White
│
~[0;47m
-
White
│'
tr '│
\c8 - Lt.Black
│
\c8
-
Lt.Black
│
~[1;30m
-
Lt.Black
│
~[1;40m
-
Lt.Black
│'
tr '│ \c9 - Lt.White │
\c9
-
Lt.Red
│
~[1;31m
-
Lt.Red
│
~[1;41m
-
Lt.Red
│'
tr '│
\cA - Lt.Red
│
\cA
-
Lt.Green
│
~[1;32m
-
Lt.Green
│
~[1;42m
-
Lt.Green
│'
tr '│
\cB - Lt.Cyan
│
\cB
-
Lt.Yellow
│
~[1;33m
-
Lt.Yellow
│
~[1;43m
-
Lt.Yellow
│'
tr '│
\cC - Lt.Purple
│
\cC
-
Lt.Blue
│
~[1;34m
-
Lt.Blue
│
~[1;44m
-
Lt.Blue
│'
tr '│
\cD - Lt.Green
│
\cD
-
Lt.Purple
│
~[1;35m
-
Lt.Purple
│
~[1;45m
-
Lt.Purple
│'
tr '│
\cE - Lt.Blue
│
\cE
-
Lt.Cyan
│
~[1;36m
-
Lt.Cyan
│
~[1;46m
-
Lt.Cyan
│'
tr '│
\cF - Lt.Yellow
│ \cF - Lt.White │ ~[1;37m - Lt.White │
~[1;47m
-
Lt.White
│'
tr '│C│C│C│C│'
se '└────────────────┴─────────
Press
──┴──
Any
─
Key
───────────┴──────────────────────┘g1'
return
GRID1: /* Draws that Color Select Graphic in "MCI Swapper" & "MCI Changer" */
call CLEAR ; tr '1H
├───────────────────────────────┬─────────────────────────────┬───────────────┤'
tr '│
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█│
<══
Original Color Template
══>
│
█
█
█
█
█
█
█
█
│'
tr '│
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
│C│
G
H
I
J
K
L
M
N
│'
tr '│
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█│
<══
Modified Color Template
══>
│
█
█
█
█
█
█
█
█
│'
tr '├───────────────────────────────┤C├───────────────┤'
tr '│
ForeGround MCI Colors
│
[
U
]
se These
[
Q
]
uit Now
│
BackGrounds
│'
tr '└───────────────────────────────┴─────────────────────────────┴───────────────┘'
return
GRID2: /* Cleans up Text Box at Bottom of Screen AFTER Above is Printed. */
tr '1H
├─────────────────────────────────────────────────────────────────────────────┤'
do 5 ; tr '│C│' ; end ; call CLEAR
tr '└─────────────────────────────────────────────────────────────────────────────┘'
return
HELP: /* Figure Out Which Help Screen to Display, then Display it. */
a='HELP'||pt1r||pt1c ; signal (a)
HELP11: /* Row 1, Column 1 */
tr '2H z4ce Lower 8 Colors into Higher 8 Colors z0 '
tr '2H '
tr '2H cb Some older Arexx and/or Text files for CNet Amiga may have been written '
tr '2H to only take advantage of the first eight MCI Color Codes. This module will '
tr '2H convert the lower eight MCI Color Codes into the upper eight MCI Colors. '
return
HELP12: /* Row 1, Column 2 */
tr '2H z4cb Control-Y into Control-Q z0 '
tr '2H '
tr '2H ce Sometimes, it may be helpful if all Color Codes used the FOUR character '
tr '2H long Control-Q format, instead of the THREE character Control-Y format. Use '
tr '2H this module to change all Control-Y Color Codes into Control-Q Color Codes. '
return
HELP13: /* Row 1, Column 3 */
tr '2H z4ce Slash into Control-Y z0 '
tr '2H '
tr '2H cb Versions of CNet Amiga earlier than v2.42e used the SLASH character as '
tr '2H the MCI Command Character. This module UPDATES older MCI Color Codes that '
tr '2H used the SLASH into newer MCI formats that use the Control-Y character. '
return
HELP14: /* Row 1, Column 4 */
tr '2H z4cb MCI Color Swapper z0 '
tr '2H '
tr '2H ce This module lets you select alternate colors for those presently used in '
tr '2H the file you wish to convert. For instance, using this module, change ALL '
tr '2H occurances of green into yellow, red into blue, yellow into purple, etc. '
return
HELP15: /* Row 1, Column 5 */
tr '2H z4ce High 8 Colors into Low 8 Colors / Low 8 Colors into High 8 Colors z0 '
tr '2H '
tr '2H cb This utility allows you to swap both the high 8 colors and the low 8 '
tr '2H colors found in the file. In other words, all light greens become greens, '
tr '2H all greens become light greens. Reds into light reds, light reds into reds. '
return
HELP16: /* Row 1, Column 6 */
tr '2H z4cb Expansion Slot # 1 z0 '
tr '2H '
tr '2H ce This spot may be filled with an additional utility module sometime in '
tr '2H the near future. Any suggestions? '
tr '2H '
return
HELP21: /* Row 2, Column 1 */
tr '2H z4cb High 8 MCI Colors into Low 8 MCI Colors z0 '
tr '2H '
tr '2H ce Although I like to suggest you always color code programs and text files '
tr '2H using the FULL spectrum of 16 MCI/ANSI Colors, you may find the need to NOT '
tr '2H use the high 8 colors (intense). This module converts all highs into lows. '
return
HELP22: /* Row 2, Column 2 */
tr '2H z4ce Control-Q into Control-Y z0 '
tr '2H '
tr '2H cb It is advisable to use the THREE character Control-Y MCI Color Codes as '
tr '2H they tend to execute a bit faster than the FOUR character Control-Q Color '
tr '2H Codes. This module makes doing this conversion a snap! '
return
HELP23: /* Row 2, Column 3 */
tr '2H z4cb Old MCI Color Order into New MCI Color Order z0 '
tr '2H '
tr '2H ce Shortly before CNet Amiga went 2.04 DOS ONLY, the ORDER the MCI Color '
tr '2H codes came in differed from the ANSI Color Code order. As of Cnet v2.42e, '
tr '2H the MCI Color Codes appear in the SAME order that ANSI Color Codes appear. '
return
HELP24: /* Row 2, Column 4 */
tr '2H z4ce MCI Color Changer z0 '
tr '2H '
tr '2H cb The Color Changer is similar to the Color Swapper, with one important '
tr '2H difference. This utility CHANGES one color, while leaving the other color '
tr '2H intact. For instance, change red into green, but NOT green into red, etc. '
return
HELP25: /* Row 2, Column 5 */
tr '2H z4cb MCI Code Stripper z0 '
tr '2H '
tr '2H This is a simple utility that will STRIP, or REMOVE, all three character '
tr '2H Control-Y MCI Codes found within the specified file. This is useful for use '
tr '2H with FIDO and other Networks that frown upon MCI use. See READ_ME for info. '
return
HELP26: /* Row 2, Column 6 */
tr '2H z4ce Quit Back to CNet Now z0 '
tr '2H '
tr '2H cb A quick way to exit this program is selecting this button. You can also '
tr '2H use the QUIT button shown below, although this button exits immediately, '
tr '2H without first asking you if you are SURE you wish to leave. '
return
HELPB: /* Find Needed VIEW MODE Help Screen & Display It. */
a='HELPB'||pt2c ; signal (a)
HELPB1: /* Column 1 */
tr '2H z4ce Use NEITHER View Mode z0 '
tr '2H '
tr '2H cb Selecting to view NEITHER before or after conversion is the quickest way '
tr '2H to do a conversion, because the program does not have to worry about the '
tr '2H actual displaying of files. This mode is the preferable choice on PFILES. '
return
HELPB2: /* Column 2 */
tr '2H z4cb View BEFORE Mode z0 '
tr '2H '
tr '2H ce Selecting to view the file BEFORE the conversion will show you what the '
tr '2H file looks like in its present state, BEFORE any conversion is done to the '
tr '2H file. The finished output file will NOT be shown upon completion. '
return
HELPB3: /* Column 3 */
tr '2H z4ce View AFTER Mode z0 '
tr '2H '
tr '2H cb Selecting to view the file AFTER the conversion will only show you what '
tr '2H the file looks like AFTER it has been converted. The BEFORE, AFTER and the '
tr '2H BOTH View modes are best used when viewing TEXT and DOC files. '
return
HELPB4: /* Column 4 */
tr '2H z4cb View BEFORE and AFTER Mode z0 '
tr '2H '
tr '2H ce Selecting to view BOTH will show you what the file looks like BEFORE it '
tr '2H has been converted and will show you what it looks like AFTER it has been '
tr '2H converted. This is the preferred method when converting TEXT and DOC files. '
return
HELPC: /* Find Needed START MODE Help Screen & Display It. */
a='HELPC'||pt3c ; signal (a)
HELPC1: /* Column 1 */
tr '2H z4ce The START Operation z0 '
tr '2H '
tr '2H cb This will START the conversion operation. The LOAD file will be read in '
tr '2H line by line, then the conversion process will start. Counters for lines, '
tr '2H conversions, etc. will be shown in this window. '
return
HELPC2: /* Column 2 */
tr '2H z4cb The QUIT Operation z0 '
tr '2H '
tr '2H ce When you select QUIT, you will be asked for confirmation, upon which the '
tr '2H program will exit. This is similar to "Quit to CNet" above, except that you '
tr '2H will be asked for confirmation before the file is actually exited. '
return
HELPC3: /* Column 3 */
tr '2H z4ce The RESTART Operation z0 '
tr '2H '
tr '2H cb By selecting RESTART, the screen will be redrawn, and you will then be '
tr '2H able to select all the conversion modes again. This is helpful in the event '
tr '2H you made a wrong selection previously. '
return
HELPC4: /* Column 4 */
tr '2H z4cb The CHART Operation z0 '
tr '2H '
tr '2H ce The CHART will show you a screen of all known MCI and ANSI Color Codes, '
tr '2H in both the NEW and OLD formats. This may be helpful in your selection as '
tr '2H to which conversion process you really wish to use. '
return
HELPC5: /* Column 5 */
tr '2H z4ce The INFO Operation z0 '
tr '2H '
tr '2H cb This program was written by Dotoran of Frontiers BBS. If you find fault '
tr '2H with this utility, please call: '
tr '2H Frontiers BBS (716) / 823- 9892 ! '
return
CHECK:
if result~='###PANIC' then return
tr 'f115Hc9LOSS OF CARRIER!'
logentry 'Lost Carrier in Color Utils, v1.0'
bufferflush ; exit
SYNTAX:;ERROR:;IOERR:;e1=' Error: 'rc' ('errortext(rc)')'
e2=' Line: 'left(sigl,4)'File:';gu 1311992;a=result;gu 1311960;b=result;c='"'a||b'"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2
e=sourceline(sigl);do while e~='';e3='Source: 'left(e,37);tr e3;logentry e3;e=substr(e,38);end;bufferflush;exit
/** Last Edited: 7-Oct-95 *************************************************\
\****************************************** Frontiers BBS (716)/823-9892 **/